package br.ucb.sigplan.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import br.ucb.sigplan.beans.PlanoEnsino;

public class JasperUtil {
	public static JasperPrint getJasperPrint(String nome, List<PlanoEnsino> plano, String img) throws JRException {
		Map<String, String> params = new HashMap<String, String>();
		params.put("img", img);
		
		return JasperFillManager.fillReport(nome, params,new JRBeanCollectionDataSource(plano));
	}
		
	public static void createJasperPDF(JasperPrint jasperPrint) throws JRException {
		JasperExportManager.exportReportToPdfFile(jasperPrint,"plano.pdf");
	}
}
